<template>
<div>
  <detail-banner :sightName="sightName"
   :bannerImg="bannerImg" :gallaryImgs="gallaryImgs"></detail-banner>
  <detail-header></detail-header>
  <div style="height:20rem">
    <detail-list :list="list"></detail-list>
  </div>
</div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      sightName: '', // 大标题
      bannerImg: '', // banner
      gallaryImgs: [], // 画廊轮播
      list: []
    }
  },
  mounted () {
    this.getDetailInfo()
  },
  // activated () {
  //   this.getDetailInfo()
  // },
  methods: {
    getDetailInfo () {
      axios.get('/api/detail.json',
        {params: {id: this.$route.params.id}}
      ).then(this.getDetailInfoSucc)
    },
    getDetailInfoSucc (res) {
      res = res.data
      // console.log(res)
      if (res.ret && res.data) {
        this.sightName = res.data.sightName
        this.bannerImg = res.data.bannerImg
        this.gallaryImgs = res.data.gallaryImgs
        this.list = res.data.ticketList
      }
    }
  }
}
</script>

<style lang="stylus" scoped>

</style>
